package com.magold.circuit;

import com.magold.algorithm.Node;

/**
 * 
 * @author Eternity
 *
 */
public class CornerNode extends CircuitNode {
	private CircuitNode mNextParallelNode;
	
	public CornerNode() {
		super(null);
	}
	
	public void linkAsLeft(CircuitNode pLeft, CircuitNode pRight, CircuitNode pRightParallelNode) {
		Node.link(pRightParallelNode, this);
		mNextParallelNode = pRightParallelNode;
		
		Node.link(pLeft, this);
		Node.link(this, pRight);
	}
	
	public void linkAsRight(CircuitNode pLeft, CircuitNode pRight, CircuitNode pLeftParallelNode) {
		Node.link(this, pLeftParallelNode);
		mNextParallelNode = null;
		
		Node.link(pLeft, this);
		Node.link(this, pRight);
	}
	
	public CircuitNode nextParallel() {
		return mNextParallelNode;
	}
	
	@Override
	public boolean isConnected() {
		return true;
	}

}
